//
//  SHD_UserDataTableCell.m
//  B段项目
//
//  Created by dllo on 15/11/12.
//  Copyright © 2015年 谢美娜. All rights reserved.
//

#import "SHD_UserDataTableCell.h"

@implementation SHD_UserDataTableCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _timeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_timeLabel];
        _contentLabel = [[myContectLabel alloc]init];
        [self.contentView addSubview:_contentLabel];
        _likeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_likeLabel];
        
        
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    _timeLabel.frame = CGRectMake(15 * FitWidth, 15 * FitHeight, 200 * FitWidth, 15 * FitHeight);
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:18 * FitWidth], NSFontAttributeName, nil];
    CGRect rect = [_list.content boundingRectWithSize:CGSizeMake(345 * FitWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    _contentLabel.frame = CGRectMake(15 *FitWidth, _timeLabel.frame.origin.y + _timeLabel.frame.size.height + 15 * FitHeight, 345 * FitWidth, rect.size.height);
    _contentLabel.numberOfLines = 0;
    _likeLabel.frame = CGRectMake(15 * FitWidth, _contentLabel.frame.size.height + _contentLabel.frame.origin.y + 20 * FitHeight, 345 * FitWidth, 15 * FitHeight);
}
-(void)setList:(SHD_UserDataList *)list
{
    _list  = list;
    _timeLabel.text = list.addtime_f;
    _contentLabel.text = list.content;
    _likeLabel.text = [NSString stringWithFormat:@"喜欢:%@                评论:%@", [list.counterList objectForKey:@"like"], [list.counterList objectForKey:@"comment"]];
    _likeLabel.textColor = [UIColor lightGrayColor];
    _timeLabel.textColor = [UIColor lightGrayColor];
    _likeLabel.textAlignment  = 2;
    _likeLabel.font = [UIFont fontWithName:@"STHeitiSC-Light" size:10 * FitWidth];
    _timeLabel.font = [UIFont fontWithName:@"STHeitiSC-Light" size:10 * FitWidth];
    
    
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
